package com.permission.model;

import com.fasterxml.jackson.annotation.JsonManagedReference;
import com.solution.framework.model.BaseBean;
import org.hibernate.annotations.ForeignKey;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;

/**
 * Created with generator tools.
 * User: sunguangzhu
 * DateTime:2014-05-07 01:19:05
 */
@Entity
@Table(name = "t_per_user_role")
public class PerUserRole extends BaseBean implements java.io.Serializable {

    /**
     * 归属用户
     */
    private com.permission.model.PerUser perUser;

    /**
     * 归属角色
     */
    private com.permission.model.PerRole perRole;

    /**
     * default constructor
     */
    public PerUserRole() {
    }

    /**
     * full constructor
     *
     * @param perUser
     * @param perRole
     */
    public PerUserRole(com.permission.model.PerUser perUser, com.permission.model.PerRole perRole) {
        this.perUser = perUser;
        this.perRole = perRole;
    }

    /**
     * getter
     */
    @JsonManagedReference
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "perUser_id")
    @NotFound(action = NotFoundAction.IGNORE)
    @ForeignKey(name = "fk_peruserrole_perUser")
    public com.permission.model.PerUser getPerUser() {
        return this.perUser;
    }

    /**
     * setter
     *
     * @param perUser
     */
    public void setPerUser(com.permission.model.PerUser perUser) {
        this.perUser = perUser;
    }

    /**
     * getter
     */
    @JsonManagedReference
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "perRole_id")
    @NotFound(action = NotFoundAction.IGNORE)
    @ForeignKey(name = "fk_peruserrole_perRole")
    public com.permission.model.PerRole getPerRole() {
        return this.perRole;
    }

    /**
     * setter
     *
     * @param perRole
     */
    public void setPerRole(com.permission.model.PerRole perRole) {
        this.perRole = perRole;
    }

}
